<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
include_once("../../config.inc.php");

$_LangPath = "usercredit";
include(__Admin_Path."/logincheck.php");
include(__Language_Path."/selectlanguage_admin.php");
include(__Modules_Path."/Member.lib.php");

$arrUser = getUserDataArrayByID($_SESSION["Admin_Info"] -> ID);
if($arrUser === false)ErrMsgOutputHTML("Error1", "", 1);


$fp = @file(__Admintemplate_Path."/UserCredit/UserCommunicate.html");
$fp = implode("", $fp);
$fp = setHTMLCharset($fp);

$arrMType = array("QQNum", "SkypeAcc", "MSN", "Email", "MPhone");
$fp = str_replace("{ShowUserAcc}", $_SESSION["Admin_Info"] -> Account, $fp);
$fp = str_replace("{ShowQQNum}", $arrUser["QQNum"], $fp);
$fp = str_replace("{ShowSkypeAcc}", $arrUser["SkypeAcc"], $fp);
$fp = str_replace("{ShowMSN}", $arrUser["MSN"], $fp);
$fp = str_replace("{ShowEmail}", $arrUser["Email"], $fp);

$arrMPhone = explode("-", $arrUser["MPhone"]);
$fp = str_replace("{ShowMPhone}", $arrMPhone[1], $fp);
$fp = str_replace("{ShowAreaMPhone}", "+".$arrMPhone[0]." ".$arrMPhone[1], $fp);

$strAreaOption = "";
foreach($_arrTelArea as $strArea => $strCountry){
	if($strArea == $arrMPhone[0]){
		$strAreaOption .= "<option value='".$strArea."' selected>".$strCountry."</option>";
	}else{
		$strAreaOption .= "<option value='".$strArea."'>".$strCountry."</option>";
	}
}
$fp = str_replace("{AreaOption}", $strAreaOption, $fp);

while(list($k, $v) = each($_strUserCredit)){
	$fp = str_replace("{".$k."}", $v, $fp);
}

$strSQL = "select * from `bet_Authentication` where UserID = ".$_SESSION["Admin_Info"] -> ID;
if(!$RS = @PMA_mysql_query($strSQL, $$_Conn)){
	$GLOBALS["errormessage"] = "Find Data Error!!";
	$GLOBALS["errorhidden"] = "\nError: ".PMA_mysql_error($$_Conn).",\nLinue:".__LINE__.",\nPage:".__FILE__;
	ErrMsgOutputHTML("Error2", "", 1);
}
$arrCheckStatus = array();
while($objRows = PMA_mysql_fetch_object($RS)){
	switch($objRows -> isCheck){
		case 1:
			$arrCheckStatus[$objRows -> MType] = $_strUserCredit["Authed"];
			break;
	}
}
foreach($arrMType as $strMType){
	if($arrCheckStatus[$strMType] == ""){
		$arrCheckStatus[$strMType] = "<div style='color: #FF0000; font-weight: 700'>".$_strUserCredit["NoAuth"]."</div>";
	}else{
		$fp = str_replace("{".$strMType."Disabled}","disabled", $fp);
	}
	$fp = str_replace("{".$strMType."CheckStatus}", $arrCheckStatus[$strMType], $fp);
}

//輸出
WebOutputHTML($fp, 1);
?>